Intro to Tensorflow & Keras in R

Scott Jackson

10/13/2018

Today’s Meetup Brought To You By

American Water

Attend the Innovation Revolution - Nov 16th

First Things

Disclaimer

  • This is a long presentation, but I can take questions during. Just raise your hand high.
  • I’m speaking for myself this evening. All of my opinions are my own and do not necessarily reflect those of RStudio, Inc.

Get The Things You Need

GPU Acceleration

  • nVidia GPU
  • Proprietary drivers
  • CUDA Toolkit 9.0
  • cuDNN SDK 7.2+

https://www.tensorflow.org/install/gpu

More on GPU Acceleration

  • Multiple GPUs are supported
  • Amazon EC2 P3
  • Google Cloud Compute GPU
  • Microsoft Azure NC Series

Hosting Side Note

My tools

  • RStudio (Sorry, shameless plug, I know.)
    • You’ll want the latest versions for Jobs support!
    • Comes in Desktop & Server, FOSS and Pro flavors

Tensorflow Library

What can you do with TensorFlow?

## [1] '1.9'

Use MNIST Data

## [1] 784

and…

and…

Training

Accuracy

## [1] 0.9179

Keras Library

Basic Import

## [1] TRUE

Same Idea

Model is a bit more declarative

Training

RStudio Jobs

Step 1: Get a Script

How About That TensorFlow MNIST Script?

Step 2: Execute that Job

Why do I want this?

  • Actually decent models require tons of data and lots of training time
  • Queue a job on a server and go do more important things
  • Do more than one at once

Data Sources

What kind of data do I want?

  • Predictable/Classifiable data
  • LOTS: Deep learning in particular needs a high N
  • Normalized? Not necessarily- deep learning techniques are resilient to poor normalization, provided you have enough.

Where?

Saved Models

Tensorflow

Keras

TFDeploy

CloudML

RStudio Connect

RStudio Connect Tensorflow Demo

Enjoy the show

Mobile devices

https://www.tensorflow.org/lite/

  1. Convert your saved model using https://www.tensorflow.org/lite/convert/
  2. Include in mobile projects
  3. ???
  4. Profit! (No, really…)

Web Browsers